/**
 * Created by Administrator on 2017/2/11.
 */
import { Component } from '@angular/core';
import { ResetpwdService } from './resetpassword.serve';
import { Router, ActivatedRoute, Params } from '@angular/router';

@Component({
    moduleId: module.id,
    selector: 'my-reset',
    templateUrl: 'resetpassword.html',
    providers:[ResetpwdService]
})
export class ResetComponent {
    constructor(
        private route: ActivatedRoute,
        private router: Router,
        private ResetpwdService:ResetpwdService,
    ) {}
    public  name1:string='';
    public  name2:string='';
    public sgin='';
    private email='';
    public errMessage:string;
    ngOnInit(){
        this.route.params
            .subscribe(
                (params:Params)=>{this.email= params['email'];}
            );
    }
    changepwd (pwd:string,repwd:string,email:string) {
        if (!pwd||!repwd) { return; }
        this.ResetpwdService.change(pwd,repwd,email)
            .subscribe(
                res => this.sgin=res,
                    error =>  this.errMessage = <any>error);
        console.log(this.sgin)
    }
}